package org.skatiger.jrove.component.foreach;

public class ForeachStatus {
    private final int index;

    private final boolean first;

    private final boolean last;

    private final boolean even;

    private final Integer begin;

    private final Integer end;

    private final Integer step;

    /**
     * 
     */
    public ForeachStatus(boolean first, boolean last, int index, Integer begin,
            Integer end, Integer step) {
        this.index = index;
        this.begin = begin;
        this.end = end;
        this.step = step;
        this.first = first;
        this.last = last;
        this.even = (index - begin.intValue() / step.intValue()) % 2 == 0;
    }

    public boolean isFirst() {
        return this.first;
    }

    public boolean isLast() {
        return this.last;
    }

    public boolean isEven() {
        return even;
    }

    public boolean isOdd() {
        return !even;
    }

    public Integer getBegin() {
        return begin;
    }

    public Integer getEnd() {
        return end;
    }

    public int getIndex() {
        return index;
    }

    public Integer getStep() {
        return step;
    }
}
